home *** CD-ROM | disk | FTP | other *** search
- 10 rem **********************
- 20 rem * *
- 30 rem * roemische zahlen *
- 40 rem * *
- 50 rem * (w) j.baumm *
- 60 rem * (c) 64'er 1988 *
- 70 rem * *
- 80 rem **********************
- 90 rem
- 100 poke 53280,2
- 110 poke 53281,7
- 120 poke 646,0
- 130 rem
- 140 rem menue
- 150 rem
- 160 dim r(13),r$(13)
- 170 :
- 180 print "[147]64'er":fa=0
- 190 print tab(7)"roemisch --> dezimal [1]"
- 200 print tab(7)"dezimal --> roemisch [2]"
- 210 print tab(7)"e n d e --> [3]"
- 220 get t$:if t$<"1" or t$>"3" then 220
- 230 t=val (t$)
- 240 on tgoto 260,570,1180
- 250 rem
- 260 rem roemisch -> dezimal
- 270 rem
- 280 z1=0:z2=0:z3=0:dc=0:fg=0:r$=""
- 290 p1=0:p2=0:p3=0:p4=0:p5=0:p6=0
- 300 print "[147]":fa=1
- 310 input " roemische zahl";ro$
- 320 for i=len (ro$) to 1 step -1
- 330 r$=mid$ (ro$,i,1)
- 340 :
- 350 if r$<>"i" and r$<>"v" and r$<>"x" and r$<>"l" and r$<>"c" then y=0:goto 370
- 360 y=1
- 370 if y=0 and r$<>"d" and r$<>"m" then:gosub 910:goto 260
- 380 if r$="i" then r=1:p1=p1+1:if z1=1 then r=-1
- 390 if r$="v" then r=5:z1=1:p2=p2+1
- 400 if r$="x" then r=10:z1=1:p3=p3+1:if z2=1 then r=-10
- 410 if r$="l" then r=50:z2=1:p4=p4+1
- 420 if r$="c" then r=100:z2=1:p5=p5+1:if z3=1 then r=-100
- 430 if r$="d" then r=500:z3=1:p6=p6+1
- 440 if r$="m" then r=1000:z3=1
- 450 dc=dc+r
- 460 next i
- 470 gosub 640
- 480 rem
- 490 rem vergleich
- 500 rem
- 510 if ro$<>rm$ then gosub 910
- 520 if fg=1 then 260
- 530 gosub 990
- 540 gosub 1090
- 550 if a$="j" then 260
- 560 goto 180
- 570 gosub 590
- 580 rem
- 590 rem dezimal -> roemisch
- 600 rem
- 610 :fa=2
- 620 input "[147] dezimale zahl";d:de=d
- 630 if d<0 or d>240000 then gosub 940:goto 620
- 640 if fa=1 then d=dc
- 650 for i=1 to 13
- 660 read da,da$
- 670 r(i)=int (d/da)
- 680 d=d-(r(i)*da)
- 690 r$=""
- 700 if r(i)>1 then gosub 860:goto 720
- 710 if r(i)>0 then r$(i)=da$
- 720 next i
- 730 rem
- 740 rem roemische zahl
- 750 rem
- 760 for i=1 to 13
- 770 rm$=rm$+r$(i):r$(i)=""
- 780 next i
- 790 if fa=1 then 820
- 800 gosub 990
- 810 if fa=2 then 830
- 820 return
- 830 gosub 1090
- 840 if a$="j" then goto 570
- 850 goto 180
- 860 for j=1 to r(i)
- 870 r$(i)=r$(i)+da$
- 880 next j
- 890 return
- 900 rem
- 910 rem falsche eingabe
- 920 rem
- 930 fg=1
- 940 print " eingabefehler!"
- 950 for x=1 to 200:next x
- 960 restore:rm$="":ro$=""
- 970 return
- 980 rem
- 990 rem print
- 1000 rem
- 1010 if fa=1 then 1030
- 1020 if fa=2 then 1050
- 1030 print " ";ro$;" =";dc
- 1040 goto 1070
- 1050 print " ";de;"= ";rm$
- 1060 restore:rm$=""
- 1070 return
- 1080 rem
- 1090 rem wiederholung
- 1100 rem
- 1110 print " nochmal (j/n)"
- 1120 get a$:if a$<>"j" and a$<>"n" then 1120
- 1130 restore:ro$="":rm$=""
- 1140 return
- 1150 data 1000,"m",900,"cm",500,"d",400,"cd",100,"c"
- 1160 data 90,"xc",50,"l",40,"xl",10,"x",9,"ix",5,"v",4,"iv",1,"i"
- 1170 rem
- 1180 end
-